$BDCDJ0616 = Get-Content "C:\Users\LQ\Desktop\BDCDJ0616.txt";
$BDCDJ0616 =  $BDCDJ0616[1..$BDCDJ0616.Length] | %{$_.Replace("`"","")};
<#
$output_1 =  ($BDCDJ0616 |%{$_.Split(",")[0]} | ?{$_ -ne "SJHQBS" -or $_ -ne "SJHQSJ" }|%{ ("{{{0}:{0}}}" -F $_).ToLower()} ) -join ",";
$filePath = "C:\Users\LQ\Desktop\1.txt";
Remove-Item $filePath;
$output_1 >> $filePath;
#>
$format_1 = "{{{0}:{0}}},"
$format_2= "{{{0}:{0}:to_date(substr(?,0,19),'YYYY-MM-DD HH24:MI:SS')}},"
$format_map = "map.get(`"{0}`"),";
$format_map_date = "map.get(`"{0}`").toString(),";
$output_1="";
$output_map="";
foreach ($item in $BDCDJ0616)
{
  $parts = $item.Split(",");
  $fieldName = $parts[0].ToLower();
  if (($fieldName -eq "sjhqbs") -or($fieldName  -eq "sjhqsj")  -or ($fieldName  -eq "sjscsj"))
  {
      continue;
  }
  $type = $parts[1];
  if ($type -eq "DATE")
  {
      $output_1 +=   ($format_2 -F $fieldName);
      $output_map +=($format_map_date -F $fieldName);
  }
  else
  {
       $output_1 +=   ($format_1 -F $fieldName);
     
     $output_map +=($format_map -F $fieldName);
       
   }

   
}

$filePath = "C:\Users\LQ\Desktop\1.txt";
Remove-Item $filePath;
$output_1 >> $filePath;
 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $filePath ;
$output_map >> $filePath;
